#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk

DEB_SHLIBDEPS_INCLUDE := /usr/lib/atlas
ver    := $(DEB_UPSTREAM_VERSION)
soname := libdsdp-$(ver)gf.so

debian/build-stamp:
	$(MAKE) DSDPROOT=`pwd` OPTFLAGS="-fPIC -O3" dsdpapi LAPACKBLAS="-llapack"
	cd lib && \
		ar x libdsdp.a && \
		$(CC) -shared -Wl,-soname=$(soname) -o $(soname) *.o -llapack -lblas -lm && \
		ln -s $(soname) libdsdp.so && rm *.o
	$(MAKE) DSDPROOT=`pwd` -C examples clean
	$(MAKE) DSDPROOT=`pwd` OPTFLAGS="-O3" DSDPLIB="-L$(CURDIR)/lib -ldsdp" example LAPACKBLAS=""
	touch $@

clean::
	$(MAKE) clean
	$(RM) debian/build-stamp 
	$(RM) docs/dox/docwarnings bin/results-dsdp*
	$(RM) -r docs/dox/html 

build/dsdp-doc:: debian/build-stamp
	cd docs/dox && doxygen

get-orig-source:
	uscan --rename --upstream-version 0 || true
	@echo successfully retrieved upstream tarball
